#include "stdafx.h"
#include "OrganizeControl.h"
#include "ui_OrganizeControl.h"
#include "BaseInclude.h"
#include "PlanFunction.h"
#include <QDate>

/***********************************************************************************************************************************/
QOrganizeControl::QOrganizeControl(QDialog *parent)
: QDialog(parent)
{
	ui = new Ui::OrganizeControl();
	ui->setupUi(this);

	treeModel = new QRecordTreeModel;
	ui->organTreeView->setModel(treeModel);
	ui->organTreeView->setUniformRowHeights(true);
	initTreeModel();
}

QOrganizeControl::~QOrganizeControl()
{
	delete ui;
}

void QOrganizeControl::initTreeModel()
{
	//QString sql = "SELECT ORGAN_ID,PARENT_ID,ORGAN_NAME FROM V_STRU_ORGAN where ORGAN_TYPE IN('101','102','103','104','105','8') START WITH ORGAN_ID = 'O00000000000318' CONNECT BY PRIOR ORGAN_ID = PARENT_ID ORDER BY ORGAN_CODE";
	QString sql = "SELECT ORGAN_ID,PARENT_ID,ORGAN_NAME FROM V_STRU_ORGAN where ORGAN_TYPE IN('101','102','103','104','105','201','202','203','204') START WITH ORGAN_ID = 'O00000000000318' CONNECT BY PRIOR ORGAN_ID = PARENT_ID ORDER BY ORGAN_CODE";
	treeModel->select(sql);
	treeModel->setFieldCol(0,1);
	treeModel->setRoot("O00000000000311");
	treeModel->setCol(2,CF_SHOW);
	treeModel->refresh();
}




